//
//  GestureVC.m
//  Demo
//
//  Created by LG on 2018/12/28.
//  Copyright © 2018 LG. All rights reserved.
//

#import "GestureVC.h"
#import "GestureBtn.h"

@interface GestureVC ()

@end

@implementation GestureVC

- (void)viewDidLoad {
    [super viewDidLoad];
    self.view.backgroundColor = [UIColor whiteColor];
    GestureBtn *btn = [GestureBtn buttonWithType:UIButtonTypeCustom];
    btn.frame = self.view.bounds;
    btn.backgroundColor = [UIColor yellowColor];
    [btn addTarget:self action:@selector(btnClick:) forControlEvents:UIControlEventTouchUpInside];
    [self.view addSubview:btn];
    
    UIBezierPath *bezierPath = [UIBezierPath bezierPath];
    [bezierPath moveToPoint:CGPointMake(50, 100)];
    [bezierPath addLineToPoint:CGPointMake(150, 100)];
    [bezierPath addLineToPoint:CGPointMake(50, 250)];
    [bezierPath closePath];
    bezierPath.lineWidth = 10.;
    CAShapeLayer *shapeLayer = [CAShapeLayer layer];
    shapeLayer.frame = btn.bounds;
    shapeLayer.fillColor = [[UIColor clearColor] CGColor];
    shapeLayer.strokeColor = [[UIColor redColor]CGColor];
    shapeLayer.lineWidth = 20;
    shapeLayer.path = bezierPath.CGPath;
    [bezierPath stroke];
    [btn.layer addSublayer:shapeLayer];
}

- (void)btnClick:(UIButton*)sender
{
    
}

/*
#pragma mark - Navigation

// In a storyboard-based application, you will often want to do a little preparation before navigation
- (void)prepareForSegue:(UIStoryboardSegue *)segue sender:(id)sender {
    // Get the new view controller using [segue destinationViewController].
    // Pass the selected object to the new view controller.
}
*/

@end
